<?php
//微信用户相关

namespace App\Http\Controllers;

use App\Models\NoteModel;
use Illuminate\Http\Request;
use App\Repositories\NoteRepository;
use Illuminate\Support\Facades\DB;

class NoteController extends BaseController
{

    /**
     * @param Request $request
     * @param NoteRepository $noteRepository
     * @return \Illuminate\Http\JsonResponse
     */
    public function save (Request $request, NoteRepository $noteRepository)
    {
        $allParams = $request->all();
        $rst = @$noteRepository->save($allParams);
        if ($rst) {
            return $this->success([]);
        }
        return $this->error(405, '保存失败，请稍后再试');
    }

    public function detail ($id)
    {
        $note = @NoteModel::find($id);
        if ($note) {
            return $this->success($note);
        }
        return $this->error(410, '数据获取失败');
    }

}
